﻿function BookList()  
{
    this.ID = 0 ;
    this.Badge = '' ;
    this.FirstName = '' ;
    this.MiddleName= '' ;
    this.LastName = '';
    this.Topic = '';
    this.TwiterHandle= '' ;
    this.LinkedInHandle = '';
    this.KloutHandle = '';
    this.Email = '';
    this.TwiterUri = '';
    this.LinkedInUri= '' ;
    this.ThumbnailUrl= '' ;
    this.CustomUrl= '' ;
    this.PhotoUrl = '';
    this.Links = '';
    this.Notes = '';
    this.ActiveStatus = 0;
    this.KloutScore =0;
    this.Footprint  =0;
    this.Engagement  =0;
    this.TwitterFollowers =0;
    this.LinkedInConnections  =0;
    this.UpdateDate = '';
}


function linkify(inputText) {
    var replacedText, replacePattern1, replacePattern2, replacePattern3;

    //URLs starting with http://, https://, or ftp://
    replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
    replacedText = inputText.replace(replacePattern1, '<a href="$1" target="_blank">$1</a>');

    //URLs starting with "www." (without // before it, or it'd re-link the ones done above).
    replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
    replacedText = replacedText.replace(replacePattern2, '$1<a href="http://$2" target="_blank">$2</a>');

    //Change email addresses to mailto:: links.
    replacePattern3 = /(([a-zA-Z0-9\-\_\.])+@[a-zA-Z\_]+?(\.[a-zA-Z]{2,6})+)/gim;
    replacedText = replacedText.replace(replacePattern3, '<a href="mailto:$1">$1</a>');

    return replacedText;
}
function syntaxHighlight(json) {
    json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
    return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
        var cls = 'number';
        if (/^"/.test(match)) {
            if (/:$/.test(match)) {
                cls = 'key';
            } else {
                cls = 'string';
            }
        } else if (/true|false/.test(match)) {
            cls = 'boolean';
        } else if (/null/.test(match)) {
            cls = 'null';
        }
        return '<span class="' + cls + '">' + match + '</span>';
    });
}
function urlToLink(text) {
    var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@@#\/%?=~_|!:,.;]*[-A-Z0-9+&@@#\/%=~_|])/ig;
    return text.replace(exp, "<a href='$1'>$1</a>");
}

//Read more: Adding your Twitter feed to your website with jQuery | PC Pro blog http://www.pcpro.co.uk/blogs/2010/09/13/adding-your-twitter-feed-to-your-website-with-jquery/#ixzz2uiMw4O00
function jsDate(dotnetDate) {
    var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Unknown"];
    try {
        var d = dotnetDate; // "2013-12-20T02:26:23.337";
        var year = new Date(d).getFullYear();
        var month = new Date(d).getMonth();
        var date = new Date(d).getDate();
        var formatdate = date + "-" + months[month] + "-" + year;
        return formatdate;
        //return d.toString("d-MMM-yyyy");
    }
    catch (e) {
    }
    return dotnetDate;
}


//http://www.pcpro.co.uk/blogs/2010/09/13/adding-your-twitter-feed-to-your-website-with-jquery/
//http://snook.ca/archives/javascript/embed-twitter-status